## ask tagged name from input
echo "Please enter the name of docker image of the service :"
## read the name
read name

## default image name
tempName=cataglogs-nginx:v2

## prodContainer in prod env
prodContainer=catalogs-nginx

## prodNetwork in prod env
prodNetwork=service_net


## build image
docker build . -t $tempName --platform linux/amd64
##tag the built image
docker tag $tempName $name

## push to remote repository
docker push $name

## log in server and pull the image
ssh culbert "docker pull $name &&
  docker stop $prodContainer && docker rm $prodContainer &&
  docker run -d --name $prodContainer --net $prodNetwork -p 2880:80 $name"

